from ..core.database import Database
from ..config.manager import ConfigManager


def migrate():
    config = ConfigManager().data
    db = Database()

    with db.get_connection() as conn:
        for category in config["categories"]:
            for tool in category["tools"]:
                conn.execute(
                    """INSERT INTO tools 
                    (name, command, category) 
                    VALUES (?, ?, ?)""",
                    (tool["name"], tool["command"], category["name"])
                )